﻿#pragma once

#include <any>
#include <string>
#include <map>
#include <vector>
#include "DefInfo/ClassDef.h"

enum PropertyCondition
{
	PC_if_hp_less_then_value,
	PC_if_hp_percent_less_then_value,
};

struct Property {
	std::string name;		// 名称
	std::any value;			// float/double 值 hp, hp percent
	std::any value2 = 10;	// int 类型 hp, hp percent

	 /* An enum type.
	The documentation block cannot be put after the enum!
	 */
	PropertyCondition condition;
	SpecializationID spec_id;
	Property& operator=(const Property& prop);
	void SaveConfig();
	void Print();
};

using MapProperty = std::map<std::string, Property*>;
using VecProperty = std::vector<Property>;

struct GeneralConfig {
	int heal_min_lower = 500;			//  500 总共 1000
	bool force_attack_target = true;
	bool force_aoe_target = false;
	unsigned int force_aoe_number = 1;
	unsigned int use_azerite_neck_spell = 1;
	unsigned int use_conro_spell = 1;
	double MinHealSpellTrigger_HpPecent();
};

struct InterfaceClassConfig
{
	VecProperty vec_property;
	MapProperty map_cache_property;
	bool has_cache = false;
	void UpdateProperty(Property& prop);
	bool CheckCache();
};

using IClassConfigPtr = std::shared_ptr<InterfaceClassConfig>;

using MapClassConfig = std::map<SpecializationID, IClassConfigPtr>;

struct RoutineConfig {
	GeneralConfig general_config;
	MapClassConfig ClassConfig;
	/* 构造函数
	*/
	RoutineConfig();
	void UpdateByDB();
};